//
//  MainViewController.swift
//  Weibo
//
//  Created by 鹏 周 on 15/12/12.
//  Copyright © 2015年 ycit. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {

    let mainTabBar = MainTabBar()
   @objc private func composeBtnDidClick() {
    print(__FUNCTION__)
    }
    
    
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        print(tabBar.classForCoder)
        mainTabBar.composeBtn.addTarget(self, action: "composeBtnDidClick", forControlEvents: .TouchUpInside)
        
        setValue(mainTabBar, forKey: "tabBar")
        print(tabBar.classForCoder)
        
        addChildViewControllers(HomeTableViewController(),title: "首页",imageName: "tabbar_home")
       addChildViewControllers(HomeTableViewController(),title: "消息",imageName: "tabbar_message_center")
        addChildViewControllers(HomeTableViewController(),title: "发现",imageName: "tabbar_discover")
        addChildViewControllers(HomeTableViewController(),title: "我",imageName: "tabbar_profile")
    }
    
    private func addChildViewControllers(vc: UIViewController,title: String,imageName: String){
        self.tabBar.tintColor = UIColor.orangeColor()
        let nav = UINavigationController(rootViewController: vc)
        vc.title = title
        vc.tabBarItem.image = UIImage(named: imageName)
    self.addChildViewController(nav)
    }
  
   

}
